<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<script type="text/javascript">
    function check() {
        if(document.getElementById("username").value=="") {
            alert("没有输入用户名！");
            return false;
        } else if(document.getElementById("password").value=="") {
            alert("没有输入密码！");
            return false;
        } else {
            alert("提交成功！")
            return true;
        }
    }
</script>
<form name="form1">
    <p>请输入账号:
    <input type="text" id="username"></p>
    <p>请输入密码:
    <input type="password" id="password" ></p>
    <input type="submit" onclick="check()">
</form>
</body>
</html>